package com.pet.comment.controller;

import com.pet.comment.service.ApCommentReplyService;
import com.pet.model.comment.dtos.CommentRepayDto;
import com.pet.model.comment.dtos.CommentReplyLikeDto;
import com.pet.model.comment.dtos.CommentReplySaveDto;
import com.pet.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 评论回复
 */
@RestController
@RequestMapping("api/commentReply")
public class ApCommentReplyController {
    @Autowired
    private ApCommentReplyService apCommentReplyService;

    /**
     * 保存评论回复
     */
    @PostMapping("save")
    public ResponseResult saveCommentReply(@RequestBody CommentReplySaveDto dto){
        return apCommentReplyService.saveCommentReply(dto);
    }

    /**
     * 加载回复列表
     */
    @PostMapping("load")
    public ResponseResult<List> loadCommentReply(@RequestBody CommentRepayDto dto){
        return apCommentReplyService.loadCommentReply(dto);
    }

    /**
     * 回复点赞
     */
    @PostMapping("like")
    public ResponseResult<Map<String, Object>> likeCommentReply(@RequestBody CommentReplyLikeDto dto){
        return apCommentReplyService.likeCommentReply(dto);
    }
}
